package action;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.RoomsDao;

import entity.Rooms;
import factory.DaoFactory;

public class FreeRoomQuery extends HttpServlet{
	
	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);

	}

	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		RoomsDao rd = DaoFactory.getRoomsDao();
		
		List<Rooms> list = null;
		
		try {
			list = rd.restList();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		req.getSession().setAttribute("List", list);
		RequestDispatcher rds = req.getRequestDispatcher("../freeRoomQuery.jsp");
		rds.forward(req, resp);
		
		
	}

}
